package hflyeer.o2o.enums;

public enum ShopStateEnum {
	
	CHECH(0,"审核中"),SUCCESS(200,"操作成功"),UPDATE_FAIL(521,"店铺更新失败"),
	OFFLINE(-1,"非法店铺"),PASS(202,"通过认证"),NULL_SHOP_ID(501,"shopId为空"),NULL_SHOP(502,"shop信息为空"),
	NULL_SHOP_OWNER(503,"创建者id为空"),NULL_SHOP_NAME(504,"店铺名称为空"),INNER_ERROR(505,"内部错误");
	
	private int state;
	private String stateInfo;
	
	private ShopStateEnum(int state,String stateInfo) {
		this.state = state;
		this.stateInfo = stateInfo;
	}

	public int getState() {
		return state;
	}

	public String getStateInfo() {
		return stateInfo;
	}
	
	/**
	 * 根据状态值返回对应的枚举，没有则返回null
	 * @param state
	 * @return
	 */
	public 	static ShopStateEnum stateOf(int state) {
		for(ShopStateEnum stateEnum : values()) {
			if(stateEnum.getState()==state)
				return stateEnum;
		}
		return null;
	}
}	